package lab02.test11;

public class Square extends Rectangle {
    double c;

    Square(double length, double width) {
        super(length, width);
    }

    double getDiagonal() {
        return c = Math.sqrt(length * length + width * width);
    }

    @Override
    public void printMyWay() {
        System.out.println("正方形的长length=" + length + "宽width=" + width);
        System.out.println("面积area=" + getArea());
        System.out.println("周长perimeter=" + getPerimeter());
        System.out.println("对角线diagonal=" + getDiagonal());
    }
}
